package com.cli.apisdk.spi;

import cn.hutool.core.collection.CollUtil;
import com.cli.apisdk.checkpoint.model.DeviceMetaData;
import com.cli.apisdk.constant.TypeConsts;
import com.cli.apisdk.constant.VendorConsts;
import com.cli.apisdk.model.ResourceType;

import java.util.List;

/**
 * @author: xiongmin
 * @since create by 2022/7/22 17:52
 */
public class CheckPointGenerateUrlService implements GenerateUrlService {
    @Override
    public String getVendor() {
        return VendorConsts.CHECK_POINT;
    }

    @Override
    public String getType() {
        return TypeConsts.MANAGEMENT_SERVER;
    }

    @Override
    public List<String> generateUrls(DeviceMetaData deviceMetaData, ResourceType resourceType) {
        List<String> result = CollUtil.newArrayList();
        switch (resourceType) {
            case SESSION_LOGIN: {
                String url = "https://" + deviceMetaData.getMgmtIp() + ":" + deviceMetaData.getPort() + "/web_api/login";
                result.add(url);
                break;
            }
            default:
                throw new RuntimeException("CheckPoint 暂不支持["+resourceType+"]资源类型");
        }
        return result;
    }
}
